package io;

import java.io.Serializable;
import java.util.Arrays;

//使用当前实例测试对象流的序列化以及反序列化操作
public class Person implements Serializable {
    //实现序列化接口后最好主动定义序列化保本号这个常量
    //这样一来对象序列化就不会根据类的结构生成一个版本号，而使用固定值
    //那么反序列化，只要还原对象和当前类的版本号就一致可以进行还原

    public static final long serialVersionUID = 1L;
    private  String name;//姓名
    private int age;//年龄
    private String gender;//性别
    private transient String[] otherInfo;//其他信息
    //javabean

    public Person() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String[] getOtherInfo() {
        return otherInfo;
    }

    public void setOtherInfo(String[] otherInfo) {
        this.otherInfo = otherInfo;
    }

    public Person(String name, int age, String gender, String[] otherInfo) {
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.otherInfo = otherInfo;
    }

}
